<template>
  <header class="layout-header" :style="headerStyle">
    <div class="header-top">
      <div class="header-left">
        <div class="header-item header-item-1">
          <i v-if="topLeftIcon" :class="topLeftIcon" class="header-icon"></i>
          {{ topLeftContent }}
        </div>
      </div>
      <div class="header-right">
        <div class="header-item header-item-2">{{ topRightContent }}</div>
      </div>
    </div>
    <div class="header-bottom">
      <div class="header-left">
        <div class="header-item header-item-3">{{ bottomLeftContent }}</div>
      </div>
      <div class="header-right">
        <div class="header-item header-item-4">{{ bottomRightContent }}</div>
      </div>
    </div>
  </header>
</template>

<script>
export default {
  name: 'PlutoDetailHeader',
  props: {
    // 内容配置
    topLeftContent: {
      type: String,
      default: ''
    },
    topRightContent: {
      type: String,
      default: ''
    },
    bottomLeftContent: {
      type: String,
      default: ''
    },
    bottomRightContent: {
      type: String,
      default: ''
    },
    // 图标配置
    topLeftIcon: {
      type: String,
      default: 'el-icon-document'
    },
    // 样式配置
    backgroundColor: {
      type: String,
      default: '#4377E4'
    },
    height: {
      type: String,
      default: '80px'
    },
    padding: {
      type: String,
      default: '12px 25px'
    }
  },
  computed: {
    headerStyle() {
      return {
        backgroundColor: this.backgroundColor,
        height: this.height,
        padding: this.padding
      }
    }
  }
}
</script>

<style scoped>
.layout-header {
  width: 100%;
  color: white;
  box-sizing: border-box;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(67, 119, 228, 0.2);
}

.header-top,
.header-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.header-top {
  height: 30px;
  margin-bottom: 4px;
}

.header-bottom {
  /* 高度自适应内容 */
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
}

.header-left {
  justify-content: flex-start;
}

.header-right {
  justify-content: flex-end;
}

/* 图标样式 */
.header-icon {
  font-size: 24px;
  margin-right: 8px;
}

.header-item {
  color: white;
  font-family: PingFangSC-Medium, 'Segoe UI', Roboto, sans-serif;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

.header-item-1 {
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-item-2,
.header-item-3,
.header-item-4 {
  font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .layout-header {
    padding: 8px 16px;
    height: 70px;
  }

  .header-top {
    height: 24px;
    margin-bottom: 6px;
  }

  .header-item-1 {
    font-size: 16px;
  }

  .header-item-2,
  .header-item-3,
  .header-item-4 {
    font-size: 12px;
  }
}
</style>
